package alfabankapi

import (
	"fmt"
	"testing"
)

func TestGetStatementTransactions(t *testing.T) {
	config := APIConfig{
		Sandbox:     true,
		ClientID:    "802823ff-f922-480f-b8d4-90f9057a2915",
		RedirectURI: "http://localhost",
		Scope:       "openid transactions",
		State:       "abcdef",
		CertFile:    "./test_certificate.cer",
		KeyFile:     "./test_key.key",
		CAFile:      "./russiantrustedca.pem",
		// CAFile:    "./cert/apica_2022_chain.cer",
		Password:  "4321",
		TokenFile: "./token.json",
	}

	client := NewClient(&config)

	//err := client.ReadTokenFromFile()
	//if err != nil {
	//log.Fatal(err)
	//}

	// https://developers.alfabank.ru/products/alfa-api/documentation/articles/sandbox/articles/intro/intro
	authCodeUrl := client.GetAuthCodeUrl()
	fmt.Println(authCodeUrl)

	//err := client.ExchangeCodeForToken("87bbecd0-cb70-4e85-ab36-46d9edc9b657")
	//if err != nil {
	//log.Fatal(err)
	//}

	//accountNumber := "40702810500006103990"
	//statementDate := "2018-03-15"
	//transactions, err := client.GetStatementTransactions(accountNumber, statementDate)
	//if err != nil {
	//log.Fatal(err)
	//}
	//fmt.Println(transactions)

}
